<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>新增公众号 第一步{:config('APP_NAME')}</title>

    <meta name="description" content="overview &amp; stats" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="__PUBLIC__/static/css/bootstrap.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/static/css/font-awesome.min.css" />

    <!-- page specific plugin styles -->

    <!-- text fonts -->


    <!-- ace styles -->
    <link rel="stylesheet" href="__PUBLIC__/static/css/ace.min.css" />

    <!--[if lte IE 9]>
    <link rel="stylesheet" href="__PUBLIC__/static/css/ace-part2.min.css" />
    <![endif]-->
    <link rel="stylesheet" href="__PUBLIC__/static/css/ace-skins.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/static/css/ace-rtl.min.css" />

    <!--[if lte IE 9]>
    <link rel="stylesheet" href="__PUBLIC__/static/css/ace-ie.min.css" />
    <![endif]-->

    <!-- inline styles related to this page -->

    <!-- ace settings handler -->
    <script src="__PUBLIC__/static/js/ace-extra.min.js"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

    <!--[if lte IE 8]>
    <script src="__PUBLIC__/static/js/html5shiv.js"></script>
    <script src="__PUBLIC__/static/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="no-skin">
{include file="common/header"}
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>

    {include file="common/left"}
    <div class="main-content">
        <div class="breadcrumbs  breadcrumbs-fixed" id="breadcrumbs">
            <script type="text/javascript">
                try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
            </script>

            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="#">公众号管理</a>
                </li>
                <li class="active">新增公众号</li>
            </ul><!-- /.breadcrumb -->
        </div>

        <div class="page-content">
            <div class="page-header">
                <h1>
                    新增公众号
                    <small>
                        <i class="ace-icon fa fa-angle-double-right"></i>
                        New Account
                    </small>
                </h1>
            </div><!-- /.page-header -->

            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->



                    <div class="col-sm-offset-2 col-sm-8">
                        <div class="widget-box">
                            <div class="widget-header widget-header-blue widget-header-flat">
                                <h4 class="widget-title lighter">新增公众号</h4>
                            </div>

                            <div class="widget-body">
                                <div class="widget-main">
                                    <div id="fuelux-wizard" data-target="#step-container">
                                        <ul class="wizard-steps">
                                            <li data-target="#step1" class="active">
                                                <span class="step">1</span>
                                                <span class="title">增加基本信息</span>
                                            </li>

                                            <li data-target="#step2" class="">
                                                <span class="step">2</span>
                                                <span class="title">配置公众平台</span>
                                            </li>

                                            <li data-target="#step3" class="">
                                                <span class="step">3</span>
                                                <span class="title">保存接口配置</span>
                                            </li>


                                        </ul>
                                    </div>

                                    <hr>

                                    <div class="step-content pos-rel" id="step-container">
                                        <div class="step-pane active" id="step1">

                                            <form class="form-horizontal" id="basic-form" style="display: block;">
                                                <div class="form-group ">
                                                    <label for="ipt-name" class="col-xs-12 col-sm-3 col-md-2 control-label no-padding-right">公众号名称</label>
                                                    <div class="col-xs-12 col-sm-5 col-md-7">
															<span class="block input-icon input-icon-right">
																<input type="text" id="ipt-name" class="width-100" name="public_name" data-msg="公众号名称不能为空" value="{$current_app.public_name|default=''}" >
																<i class="ace-icon fa fa-leaf"></i>
															</span>
                                                    </div>
                                                    <div class="help-block col-xs-12 col-sm-reset inline"> 必填项 </div>
                                                </div>
                                                <div class="form-group ">
                                                    <label for="ipt-oid" class="col-xs-12 col-sm-3 col-md-2 control-label no-padding-right">原始ID</label>
                                                    <div class="col-xs-12 col-sm-5  col-md-7">
															<span class="block input-icon input-icon-right">
																<input type="text" id="ipt-oid" class="width-100" data-msg="原始ID不能为空" placeholder="保存后不可在修改，请正确填写" name="public_id" value="{$current_app.public_id|default=''}" >
																<i class="ace-icon fa fa-leaf"></i>
															</span>
                                                    </div>
                                                    <div class="help-block col-xs-12 col-sm-reset inline"> 必填项 </div>
                                                </div>
                                                <div class="form-group">
                                                    <label for="slt-type" class="col-xs-12 col-sm-3 col-md-2 control-label no-padding-right">公众号类型</label>
                                                    <div class="col-xs-12 col-sm-5  col-md-5">
															<span class="block input-icon input-icon-right">

                                                                <select class="form-control" id="slt-type" name="type">
                                                                    <option value="0" {eq name="$current_app.type|default='0'" value="0"}selected{/eq}>普通订阅号</option>
                                                                    <option value="1" {eq name="$current_app.type|default='0'" value="1"}selected{/eq}>微信认证订阅号</option>
                                                                    <option value="2" {eq name="$current_app.type|default='0'" value="2"}selected{/eq}>普通服务号</option>
                                                                    <option value="3" {eq name="$current_app.type|default='0'" value="3"}selected{/eq}>微信认证服务号</option>
                                                                </select>

																<i class="ace-icon fa fa-leaf"></i>
															</span>
                                                    </div>
                                                    <div class="help-block col-xs-12 col-sm-reset inline"> 必填项 </div>
                                                </div>
                                            </form>


                                        </div>



                                    </div>

                                    <hr>
                                    <div class="wizard-actions">
                                        <button class="btn btn-success btn-next" data-last="Finish">
                                            下一步<i class="ace-icon fa fa-arrow-right icon-on-right"></i></button>
                                    </div>
                                </div><!-- /.widget-main -->
                            </div><!-- /.widget-body -->
                        </div>
                    </div>





                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
                <div class="space-6"></div>

            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div><!-- /.main-content -->

    {include file="common/footer"}

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>
</div><!-- /.main-container -->

<!-- basic scripts -->

{include file="common/base_js"}

<!-- inline scripts related to this page -->
<script type="text/javascript">

    !function($){
        "use strict";
        function bind_events(){
            $('.btn-next').off("click").on("click",function(e){
                e.preventDefault();
                var ipt_name=$('#ipt-name');
                var ipt_oid = $('#ipt-oid');
               if(!ipt_name.val()){
                   layer.msg(ipt_name.data('msg'));
                   ipt_name.focus();
                   return;
               }
               if(!ipt_oid.val()){
                   layer.msg(ipt_oid.data('msg'));
                   ipt_name.focus();
                   return;
               }

             var   $data = $('#basic-form').serialize();
               ajax_send($data);

            })
        }
        function ajax_send(_data) {
            $.ajax({
                url:'{:url("step_02")}',
                data:_data,
                type:'post',
                dataType:'json'

            }).then(function(rsp){
                console.log(rsp);
                if(rsp.error==0){
                    window.location.href = '{:url("step_02")}';
                }else{
                    layer.msg(rsp.errmsg);
                }
            });
            
        }
        $(function($) {
            bind_events();
        });
    }(jQuery);

</script>
</body>
</html>
